<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jacobi Elliptic SN, CN and DN</title>
<link rel="stylesheet" href="../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Math Toolkit 4.2.0">
<link rel="up" href="../jacobi.html" title="Jacobi Elliptic Functions">
<link rel="prev" href="jac_over.html" title="Overview of the Jacobi Elliptic Functions">
<link rel="next" href="jacobi_cd.html" title="Jacobi Elliptic Function cd">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="jac_over.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../jacobi.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="jacobi_cd.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="math_toolkit.jacobi.jacobi_elliptic"></a><a class="link" href="jacobi_elliptic.html" title="Jacobi Elliptic SN, CN and DN">Jacobi Elliptic
      SN, CN and DN</a>
</h3></div></div></div>
<h5>
<a name="math_toolkit.jacobi.jacobi_elliptic.h0"></a>
        <span class="phrase"><a name="math_toolkit.jacobi.jacobi_elliptic.synopsis"></a></span><a class="link" href="jacobi_elliptic.html#math_toolkit.jacobi.jacobi_elliptic.synopsis">Synopsis</a>
      </h5>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">jacobi_elliptic</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span> <span class="special">{</span>

 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">V</span><span class="special">&gt;</span>
 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">jacobi_elliptic</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">U</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">V</span><span class="special">*</span> <span class="identifier">pcn</span><span class="special">,</span> <span class="identifier">V</span><span class="special">*</span> <span class="identifier">pdn</span><span class="special">);</span>

 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">V</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">&gt;</span>
 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">jacobi_elliptic</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">U</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">V</span><span class="special">*</span> <span class="identifier">pcn</span><span class="special">,</span> <span class="identifier">V</span><span class="special">*</span> <span class="identifier">pdn</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&amp;);</span>

<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
<h5>
<a name="math_toolkit.jacobi.jacobi_elliptic.h1"></a>
        <span class="phrase"><a name="math_toolkit.jacobi.jacobi_elliptic.description"></a></span><a class="link" href="jacobi_elliptic.html#math_toolkit.jacobi.jacobi_elliptic.description">Description</a>
      </h5>
<p>
        The function <a class="link" href="jacobi_elliptic.html" title="Jacobi Elliptic SN, CN and DN">jacobi_elliptic</a>
        calculates the three copolar Jacobi elliptic functions <span class="emphasis"><em>sn(u, k)</em></span>,
        <span class="emphasis"><em>cn(u, k)</em></span> and <span class="emphasis"><em>dn(u, k)</em></span>. The returned
        value is <span class="emphasis"><em>sn(u, k)</em></span>, and if provided, <code class="computeroutput"><span class="special">*</span><span class="identifier">pcn</span></code> is set to <span class="emphasis"><em>cn(u, k)</em></span>,
        and <code class="computeroutput"><span class="special">*</span><span class="identifier">pdn</span></code>
        is set to <span class="emphasis"><em>dn(u, k)</em></span>.
      </p>
<p>
        The functions are defined as follows, given:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../equations/jacobi1.svg"></span>

        </p></blockquote></div>
<p>
        The the angle <span class="emphasis"><em>φ</em></span> is called the <span class="emphasis"><em>amplitude</em></span>
        and:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../equations/jacobi2.svg"></span>

        </p></blockquote></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
          <span class="emphasis"><em>φ</em></span> is called the amplitude. <span class="emphasis"><em>k</em></span> is
          called the elliptic modulus.
        </p></td></tr>
</table></div>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top">
<p>
          Rather like other elliptic functions, the Jacobi functions are expressed
          in a variety of different ways. In particular, the parameter <span class="emphasis"><em>k</em></span>
          (the modulus) may also be expressed using a modular angle α, or a parameter
          <span class="emphasis"><em>m</em></span>. These are related by:
        </p>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">k = sin α</span>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">m = k<sup>2</sup> = sin<sup>2</sup>α</span>
          </p></blockquote></div>
<p>
          So that the function <span class="emphasis"><em>sn</em></span> (for example) may be expressed
          as either:
        </p>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">sn(u, k)</span>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">sn(u \ α)</span>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">sn(u | m)</span>
          </p></blockquote></div>
<p>
          To further complicate matters, some texts refer to the <span class="emphasis"><em>complement
          of the parameter m</em></span>, or 1 - m, where:
        </p>
<div class="blockquote"><blockquote class="blockquote"><p>
            <span class="serif_italic">1 - m = 1 - k<sup>2</sup> = cos<sup>2</sup>α</span>
          </p></blockquote></div>
<p>
          This implementation uses <span class="emphasis"><em>k</em></span> throughout, and makes this
          the first argument to the functions: this is for alignment with the elliptic
          integrals which match the requirements of the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Technical
          Report on C++ Library Extensions</a>. However, you should be extra
          careful when using these functions!
        </p>
</td></tr>
</table></div>
<p>
        The final <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
        be used to control the behaviour of the function: how it handles errors,
        what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">policy
        documentation for more details</a>.
      </p>
<p>
        The following graphs illustrate how these functions change as <span class="emphasis"><em>k</em></span>
        changes: for small <span class="emphasis"><em>k</em></span> these are sine waves, while as
        <span class="emphasis"><em>k</em></span> tends to 1 they become hyperbolic functions:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../graphs/jacobi_sn.svg" align="middle"></span>

        </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../graphs/jacobi_cn.svg" align="middle"></span>

        </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../graphs/jacobi_dn.svg" align="middle"></span>

        </p></blockquote></div>
<h5>
<a name="math_toolkit.jacobi.jacobi_elliptic.h2"></a>
        <span class="phrase"><a name="math_toolkit.jacobi.jacobi_elliptic.accuracy"></a></span><a class="link" href="jacobi_elliptic.html#math_toolkit.jacobi.jacobi_elliptic.accuracy">Accuracy</a>
      </h5>
<p>
        These functions are computed using only basic arithmetic operations and trigonometric
        functions, so there isn't much variation in accuracy over differing platforms.
        Typically errors are trivially small for small angles, and as is typical
        for cyclic functions, grow as the angle increases. Note that only results
        for the widest floating-point type on the system are given as narrower types
        have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively zero
        error</a>. All values are relative errors in units of epsilon.
      </p>
<div class="table">
<a name="math_toolkit.jacobi.jacobi_elliptic.table_jacobi_cn"></a><p class="title"><b>Table 8.70. Error rates for jacobi_cn</b></p>
<div class="table-contents"><table class="table" summary="Error rates for jacobi_cn">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> double
                </p>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> long double
                </p>
              </th>
<th>
                <p>
                  Sun compiler version 0x5150<br> Sun Solaris<br> long double
                </p>
              </th>
<th>
                <p>
                  Microsoft Visual C++ version 14.1<br> Win32<br> double
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Mathworld Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 17.3ε (Mean = 4.29ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_cn_GSL_2_1_Jacobi_Elliptic_Mathworld_Data">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 71.6ε (Mean = 19.3ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 71.6ε (Mean = 19.4ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 45.8ε (Mean = 11.4ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0.816ε (Mean = 0.0563ε)</span><br>
                  <br> (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 2.43ε (Mean = 0.803ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.68ε (Mean = 0.443ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.68ε (Mean = 0.454ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.83ε (Mean = 0.455ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Small Values
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 55.2ε (Mean = 1.64ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_cn_GSL_2_1_Jacobi_Elliptic_Random_Small_Values">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 10.4ε (Mean = 0.594ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 10.4ε (Mean = 0.602ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 26.2ε (Mean = 1.17ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Modulus near 1
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0.919ε (Mean = 0.127ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 0ε (Mean = 0ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_cn_GSL_2_1_Jacobi_Elliptic_Modulus_near_1">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 675ε (Mean = 87.1ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 675ε (Mean = 86.8ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 513ε (Mean = 126ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Large Phi
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 14.2ε (Mean = 0.927ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 5.92e+03ε (Mean = 477ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.97e+04ε (Mean = 1.9e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.97e+04ε (Mean = 1.9e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 3.27e+04ε (Mean = 1.93e+03ε)</span>
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<a name="math_toolkit.jacobi.jacobi_elliptic.table_jacobi_dn"></a><p class="title"><b>Table 8.71. Error rates for jacobi_dn</b></p>
<div class="table-contents"><table class="table" summary="Error rates for jacobi_dn">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> double
                </p>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> long double
                </p>
              </th>
<th>
                <p>
                  Sun compiler version 0x5150<br> Sun Solaris<br> long double
                </p>
              </th>
<th>
                <p>
                  Microsoft Visual C++ version 14.1<br> Win32<br> double
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Mathworld Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 2.82ε (Mean = 1.18ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_dn_GSL_2_1_Jacobi_Elliptic_Mathworld_Data">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 49ε (Mean = 14ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 49ε (Mean = 14ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 34.3ε (Mean = 8.71ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 3ε (Mean = 0.61ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.53ε (Mean = 0.473ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.53ε (Mean = 0.481ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.52ε (Mean = 0.466ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Small Values
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0.5ε (Mean = 0.0122ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1.5ε (Mean = 0.391ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_dn_GSL_2_1_Jacobi_Elliptic_Random_Small_Values">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 22.4ε (Mean = 0.777ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 22.4ε (Mean = 0.763ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 16.1ε (Mean = 0.685ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Modulus near 1
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.28ε (Mean = 0.194ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 0ε (Mean = 0ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_dn_GSL_2_1_Jacobi_Elliptic_Modulus_near_1">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 3.75e+03ε (Mean = 293ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 3.75e+03ε (Mean = 293ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 6.24e+03ε (Mean = 482ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Large Phi
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 14.1ε (Mean = 0.897ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 121ε (Mean = 22ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.82e+04ε (Mean = 1.79e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.82e+04ε (Mean = 1.79e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.67e+04ε (Mean = 1e+03ε)</span>
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<a name="math_toolkit.jacobi.jacobi_elliptic.table_jacobi_sn"></a><p class="title"><b>Table 8.72. Error rates for jacobi_sn</b></p>
<div class="table-contents"><table class="table" summary="Error rates for jacobi_sn">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> double
                </p>
              </th>
<th>
                <p>
                  GNU C++ version 7.1.0<br> linux<br> long double
                </p>
              </th>
<th>
                <p>
                  Sun compiler version 0x5150<br> Sun Solaris<br> long double
                </p>
              </th>
<th>
                <p>
                  Microsoft Visual C++ version 14.1<br> Win32<br> double
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Mathworld Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 588ε (Mean = 146ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_sn_GSL_2_1_Jacobi_Elliptic_Mathworld_Data">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 341ε (Mean = 80.7ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 341ε (Mean = 80.7ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 481ε (Mean = 113ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Data
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 4.02ε (Mean = 1.07ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.01ε (Mean = 0.584ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.01ε (Mean = 0.593ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.92ε (Mean = 0.567ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Random Small Values
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 11.7ε (Mean = 1.65ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_sn_GSL_2_1_Jacobi_Elliptic_Random_Small_Values">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.99ε (Mean = 0.347ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 1.99ε (Mean = 0.347ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.11ε (Mean = 0.385ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Modulus near 1
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
                  2.1:</em></span> Max = 0ε (Mean = 0ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_jacobi_sn_GSL_2_1_Jacobi_Elliptic_Modulus_near_1">And
                  other failures.</a>)
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 109ε (Mean = 7.35ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 109ε (Mean = 7.38ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 23.2ε (Mean = 1.85ε)</span>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Jacobi Elliptic: Large Phi
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 12ε (Mean = 0.771ε)</span><br> <br>
                  (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 4.54e+04ε (Mean = 2.63e+03ε))
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.45e+04ε (Mean = 1.51e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 2.45e+04ε (Mean = 1.51e+03ε)</span>
                </p>
              </td>
<td>
                <p>
                  <span class="blue">Max = 4.36e+04ε (Mean = 2.54e+03ε)</span>
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><h5>
<a name="math_toolkit.jacobi.jacobi_elliptic.h3"></a>
        <span class="phrase"><a name="math_toolkit.jacobi.jacobi_elliptic.testing"></a></span><a class="link" href="jacobi_elliptic.html#math_toolkit.jacobi.jacobi_elliptic.testing">Testing</a>
      </h5>
<p>
        The tests use a mixture of spot test values calculated using the online calculator
        at <a href="http://functions.wolfram.com/" target="_top">functions.wolfram.com</a>,
        and random test data generated using MPFR at 1000-bit precision and this
        implementation.
      </p>
<h5>
<a name="math_toolkit.jacobi.jacobi_elliptic.h4"></a>
        <span class="phrase"><a name="math_toolkit.jacobi.jacobi_elliptic.implementation"></a></span><a class="link" href="jacobi_elliptic.html#math_toolkit.jacobi.jacobi_elliptic.implementation">Implementation</a>
      </h5>
<p>
        For <span class="emphasis"><em>k &gt; 1</em></span> we apply the relations:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../equations/jacobi3.svg"></span>

        </p></blockquote></div>
<p>
        Then filter off the special cases:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="serif_italic"><span class="emphasis"><em>sn(0, k) = 0</em></span> and <span class="emphasis"><em>cn(0,
          k) = dn(0, k) = 1</em></span></span>
        </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="serif_italic"><span class="emphasis"><em>sn(u, 0) = sin(u), cn(u, 0) = cos(u)
          and dn(u, 0) = 1</em></span></span>
        </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="serif_italic"><span class="emphasis"><em>sn(u, 1) = tanh(u), cn(u, 1) = dn(u,
          1) = 1 / cosh(u)</em></span></span>
        </p></blockquote></div>
<p>
        And for <span class="emphasis"><em>k<sup>4</sup> &lt; ε</em></span> we have:
      </p>
<div class="blockquote"><blockquote class="blockquote"><p>
          <span class="inlinemediaobject"><img src="../../../equations/jacobi4.svg"></span>

        </p></blockquote></div>
<p>
        Otherwise the values are calculated using the method of <a href="http://dlmf.nist.gov/22.20#SS2" target="_top">arithmetic
        geometric means</a>.
      </p>
</div>
<div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
      Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
      Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
      Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
      Walker and Xiaogang Zhang<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="jac_over.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../jacobi.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="jacobi_cd.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
